package com.heima.admin.controller;

import com.heima.admin.service.SensitiveService;
import com.heima.model.admin.dtos.AdSensitiveDto;
import com.heima.model.admin.dtos.AdSensitiveListDto;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * @author Franky
 * @version 1.0
 * @project heima-leadnews-shizhan
 * @description
 * @date 2023/9/17 09:48:21
 */
@RestController
@RequestMapping("/api/v1/sensitive")
public class SensitiveController {

    @Autowired
    private SensitiveService sensitiveService;

    /**
     * 删除敏感词
     * @param id
     * @return {@link ResponseResult}
     */
    @DeleteMapping("del/{id}")
    public ResponseResult del (@PathVariable Integer id){
        return sensitiveService.del(id);
    }

    /**
     * 查询敏感词列表
     * @param sensitiveListDto
     * @return {@link ResponseResult}
     */
    @PostMapping("/list")
    public ResponseResult list(@RequestBody AdSensitiveListDto sensitiveListDto){
        return sensitiveService.list(sensitiveListDto);
    }

    /**
     * 保存敏感词
     * @param sensitiveDto
     * @return {@link ResponseResult}
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody AdSensitiveDto sensitiveDto){
        return sensitiveService.save(sensitiveDto);
    }

    /**
     * 修改敏感词
     * @param sensitiveDto
     * @return {@link ResponseResult}
     */
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitiveDto sensitiveDto){
        return sensitiveService.update(sensitiveDto);
    }



}
